<script type="text/javascript" src="{$base_dir}js/jquery.tablesorter.pager.js"></script>
<script type="text/javascript" src="{$base_dir}modules/billing/js/AJAX_PaymentStatistics.js"></script>
<script type="text/javascript">
{literal}
var current_id = '';
function loadPage(sourceDiv, pageName) {
	if (pageName == current_id) {
		return;
	}
	
	$.ajax ({
		type: 	"GET",			
		url:	  pageName + "?set_ajax_view",
		dataType: "json",	
		beforeSend: function() {
			showAjaxLoader('ajaxLoader', 'dummy', true);
		},
		complete: function() {
		  showAjaxLoader('ajaxLoader', 'dummy', false);
		},			
		success:  function(data) {
            if (data.error.code == 'OK') {
                $('#' + sourceDiv).html(data.result);
            }
            else {
                displayError(data.error.mess);              
            }									
        }
	});
	current_id = pageName;
}
				
$(document).ready(function(){
	loadPage('paymentStatisticsPageContent', 'ViewRealPaymentStatistics');	
	
	$('.nav_bg a#realPaymentStatistics').addClass('active');
	
	$('#realPaymentStatistics').click(function() {
		$('.nav_bg a').removeClass('active');
		$(this).addClass('active'); 	
	});						
	
	$('#insuranceStatistics').click(function() {
		$('.nav_bg a').removeClass('active');
		$(this).addClass('active'); 	
	});
	
});
{/literal}	
</script>

<div class='nav_left'>
	<div class='nav_right'>
		<div class='nav_bg' style='text-align: center'>
			<a id="realPaymentStatistics" href="javascript:loadPage('paymentStatisticsPageContent', 'ViewRealPaymentStatistics');">{translate}Real payment statistics{/translate}</a>			
			<a id="insuranceStatistics" class="last" href="javascript:loadPage('paymentStatisticsPageContent', 'ViewInsuranceStatistics');"> {translate}Insuarance statistics{/translate}</a>					
		</div>
	</div>
</div>

<!-- Statistics page content -->
<div id='paymentStatisticsPageContent'>

</div>

<!-- AJAX loader -->
{include file="main/element_ajax_loader.html"}
